package cn.edu.sdu.order.backend.controller;

import cn.edu.sdu.order.backend.annotation.NeedSwagger;
import cn.edu.sdu.order.backend.model.ResultContext;
import cn.edu.sdu.order.backend.model.Token;
import cn.edu.sdu.order.backend.service.SystemService;
import cn.edu.sdu.order.backend.service.TokenService;
import cn.edu.sdu.order.backend.vo.SystemVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("system")
@Api(tags = "用户")
@NeedSwagger
public class SystemController {

    @Autowired
    private SystemService systemService;

    @GetMapping("login")
    public ResultContext login(String userName, String password) {
        SystemVO systemVO = systemService.login(userName, password);
        return  ResultContext.returnSuccess(systemVO);
    }

    @GetMapping("ping")
    public ResultContext ping() {
        return ResultContext.returnSuccess("done");
    }
}
